package com.gears_software.sxdc.dccx.ui.util;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.bigkoo.pickerview.OptionsPickerView;
import com.bigkoo.pickerview.listener.CustomListener;
import com.gears_software.sxdc.dccx.R;
import com.gears_software.sxdc.dccx.data.model.Seat;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by SunMuran on 2017/7/27.
 */

public class ShowSeat {
    private OptionsPickerView seat;
    private List<Seat> seatItem = new ArrayList<>();

    public void initSeat(Context context, final TextView tv) {
        getSeat();
        seat = new OptionsPickerView.Builder(context, new OptionsPickerView.OnOptionsSelectListener() {
            @Override
            public void onOptionsSelect(int options1, int option2, int options3, View v) {
                //返回的分别是三个级别的选中位置
                String tx = seatItem.get(options1).getPickerViewText();

                tv.setText(tx);
            }
        })
                .build();

        seat.setPicker(seatItem);//添加数据源
    }

    private void getSeat() {
        seatItem.add(new Seat(1, "1"));
        seatItem.add(new Seat(2, "2"));
        seatItem.add(new Seat(3, "3"));
        seatItem.add(new Seat(4, "4"));
        seatItem.add(new Seat(5, "5"));
        seatItem.add(new Seat(6, "6"));
        seatItem.add(new Seat(7, "7"));
        seatItem.add(new Seat(8, "8"));
        seatItem.add(new Seat(9, "9"));
        seatItem.add(new Seat(10, "10"));
        seatItem.add(new Seat(11, "11"));
    }

    public void showSeat() {
        seat.show();
    }

}
